How to Migrate ERPNext sites to Cloud Clusters
In this article, we will show you how to migrate an ERPNext site from current server to Cloud Clusters. We will migrate erpnext-7495-erp-0 to erpnext-7496-erp-0 as an example.
1 Take backups for the source ERPNext instance
The command below will navigate to the frappe-bench
directory of your ERPNext installation and back up the source ERPNext instance. The step will generate 4 files.
First, Navigate to the frappe-bench
directory of your ERPNext installation. For example in Cloud Clusters,
# cd /cloudclusters/erpnext/frappe-bench
Then, back up the source ERPNext instance. The step will generate 4 files.
Use the following command if you are backing up an ERPNext in Cloud Clusters,
# gosu erpnext bench --site default backup --with-files --ignore-backup-conf
Note: The site name is "default" in Cloud Clusters's ERPNext instances.
If your ERPNext is hosted in other providers, please use the following command.
# bench --site {site-name} backup --with-files --ignore-backup-conf
2 Upload Backups to the Destination Server by FTP
Download all backup files then upload all backup files to destination server. Before you proceed, please make sure you have an ERPNext installed on the Cloud Clusters platform. If you need help on this step, take a look at the guide on how to transfer files using FTP.
3 Update files permissions
In the destination server, launch an SSH session and update file permissions for the backup files.
# chown erpnext:erpnext /cloudclusters/erpnext/ -R
4 Get MariaDB ROOT Password
Before restoring data into ERPNext, get the MariaDB ROOT password from envionment variables by using the command in the SSH session.
# env | grep MYSQL_ROOT_PASSWORD
5 Restore Backups to the Destination ERPNext instance
Navigate to the directory that you'd like to place all backups. In this case, we'll put the files under /cloudclusters/erpnext/frappe-bench.
# cd /cloudclusters/erpnext/frappe-bench
Using command below to restore your ERPNext site. Enter the MariaDB root password that you get from the step 4 while you are required to provide MariaDB root pass. It will take a few of minutes to complete restoration. Please note that the default site name is "default" in ERPNext instance.
# gosu erpnext bench --site default \
--force restore 20220531_083142-default-database.sql.gz \
--with-private-files 20220531_083142-default-private-files.tar \
--with-public-files 20220531_083142-default-files.tar
If you just want to restore your database, Please using following command:
# gosu erpnext bench --site default \
--force restore 20220531_083142-default-database.sql.gz
Note: make sure to replace the file names with yours.